<template>
  <el-row loading>
    <el-col :span="24">
       <transportLineType-edit ref="transportLineTypeEdit"></transportLineType-edit>
      <el-row >
        <el-col :span="6">
            <el-input placeholder="请输入类型编号" size="small"  style="width:100%"></el-input>
        </el-col>
        <el-col :span="6">
           <el-input placeholder="请输入类型名称" size="small"  style="width:100%">
          </el-input>
        </el-col>
        <el-col :span="6">
          <el-select placeholder="请输入机构类型"  style="width:100%">
            <!-- <el-option
              v-for="item in parentFleet"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"></el-option> -->
          </el-select>
        </el-col>
        <el-col :span="6">
          <el-button type="danger"  size="small" @click="queryAll()">搜索</el-button>
        </el-col>
        <el-col :span="24" style="text-align: left;">
          <el-button  icon="el-icon-plus" type="danger" @click="handleCreatetransportLineType()" v-show="add">新增线路类型</el-button>
        </el-col>
      </el-row>
      </el-col>
       <el-col :span="24">
          <el-table :data="tableData" border style="width: 100%">
            <el-table-column prop="" label="线路类型编号" header-align="center"></el-table-column>
            <el-table-column prop="" label="线路类型名称" header-align="center"></el-table-column>
            <el-table-column prop="" label="起始机构类型" header-align="center"></el-table-column>
            <el-table-column prop="" label="终点机构类型" header-align="center" align="center"></el-table-column>
            <el-table-column prop="" label="最近更新时间" header-align="center" align="center"></el-table-column>
            <el-table-column prop="" label="更新人" header-align="center" align="center"></el-table-column>
            <el-table-column label="操作" header-align="center" align="center" width="200">
              <template slot-scope="scope">
                <el-button v-show="edit" type="primary" size="mini"
                  @click="handleEdittransportLineType(scope.row)">修改</el-button>
                <el-button  type="danger" size="mini"
                  @click="handleDeletetransportLineType(scope.row.id)">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <el-row>
        <el-col :span="24">
         <el-pagination
            background
            @size-change="handleSizeChange"
            @current-change="currentChange"
            :current-page.sync="page"
            :page-sizes="[2,4,6,8]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="counts">
          </el-pagination>
        </el-col>
      </el-row>
        </el-col>
</el-row>
</template>

<style>
  .demo-table-expand {
    font-size: 0;
  }
  .demo-table-expand label {
    width: 90px;
    color: #99a9bf;
  }
  .demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 50%;
  }


</style>

<script>
// import axios from 'axios'
import TransportLineTypeEdit from '@/components/transportLineType/transportLineTypeEdit'
  export default {
    data() {
      return {
        add:true,
        edit:true,
        loading:true,
        page:1,
        pageSize:2,
        counts:0,
        tableData: [{
          id: '12987122',
          name: '好滋好味鸡蛋仔',
          category: '江浙小吃、小吃零食',
          desc: '荷兰优质淡奶，奶香浓而不腻',
          address: '上海市普陀区真北路',
          shop: '王小虎夫妻店',
          shopId: '10333',

        }, {
          id: '12987123',
          name: '好滋好味鸡蛋仔',
          category: '江浙小吃、小吃零食',
          desc: '荷兰优质淡奶，奶香浓而不腻',
          address: '上海市普陀区真北路',
          shop: '王小虎夫妻店',
          shopId: '10333',

        }, {
          id: '12987125',
          name: '好滋好味鸡蛋仔',
          category: '江浙小吃、小吃零食',
          desc: '荷兰优质淡奶，奶香浓而不腻',
          address: '上海市普陀区真北路',
          shop: '王小虎夫妻店',
          shopId: '10333',

        }, {
          id: '12987126',
          name: '好滋好味鸡蛋仔',
          category: '江浙小吃、小吃零食',
          desc: '荷兰优质淡奶，奶香浓而不腻',
          address: '上海市普陀区真北路',
          shop: '王小虎夫妻店',
          shopId: '10333',

        }]
      }
    },
    methods: {
        //分页方法
        currentChange(val){
        this.page=val;
        this.queryAll();
      },
      handleSizeChange(val) {
        this.pageSize=val;
        this.queryAll();
        },
        //添加
      handleCreatetransportLineType(){
        this.loading = true
        this.$refs.transportLineTypeEdit.$emit('openAddTransportLineTypeDialog')
        this.loading = false
      },
      //修改
      handleEdittransportLineType(){
        // console.loading(row)
        this.loading = true
        this.$refs.transportLineTypeEdit.$emit('openEditTransportLineTypeDialog')
        this.loading=false
      },

    },
    components:{TransportLineTypeEdit}
  }
</script>

